package cn.fanqinghong.ymcc.feignClient;

import cn.fanqinghong.ymcc.domain.User;
import cn.fanqinghong.ymcc.result.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * FAN
 * 2022/7/18  17:28
 */
@FeignClient(value = "service-user",fallbackFactory = UserFallbackFactory.class)
@RequestMapping("/user")
public interface UserFeignClient {

    /**
     * 获取对象
     */
    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    JSONResult get(@PathVariable("id")Long id);


    /**
     * 保存和修改公用的
     */
    @RequestMapping(value="/save",method= RequestMethod.POST)
    JSONResult saveOrUpdate(@RequestBody User user);


    /**
     * 获取所有数据
     * @return
     */
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    JSONResult list();

}
